package struts_tag;

import java.util.ArrayList;
import java.util.Date;
import java.util.Map;

import org.apache.struts2.interceptor.RequestAware;

public class Product implements RequestAware{
	
	private int id;
	private String productName;
	private String productDesc;
	private String productPrice;
	private Map<String,Object> requestMap;
	private ArrayList<Person> list;
	
	public String execute(){
		this.id = 1000;
		this.productDesc = "Inter";
		this.productName = "CPU";
		this.productPrice = "2000";
		
		this.list = new ArrayList<Person>();
		list.add(new Person(1,"sun"));
		list.add(new Person(2,"wang"));
		list.add(new Person(3,"li"));
		list.add(new Person(4,"cui"));
		list.add(new Person(5,"liu"));
		requestMap.put("list", list);
		
		PersonComparator pc = new PersonComparator();
		requestMap.put("comparator", pc);
		
		Date date = new Date();
		requestMap.put("date", date);
		
		return "success";
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getProductName() {
		return productName;
	}
	public void setProductName(String productName) {
		this.productName = productName;
	}
	public String getProductDesc() {
		return productDesc;
	}
	public void setProductDesc(String productDesc) {
		this.productDesc = productDesc;
	}
	public String getProductPrice() {
		return productPrice;
	}
	public void setProductPrice(String productPrice) {
		this.productPrice = productPrice;
	}
	public Product(){
		
	}
	public Product(String productName, String productDesc, String productPrice){
		this.productDesc = productDesc;
		this.productName = productName;
		this.productPrice = productPrice;
	}
	public String toString() {
		return "Product [id=" + id + ", productName=" + productName + ", productDesc=" + productDesc + ", productPrice="
				+ productPrice + "]";
	}
	public void setRequest(Map<String, Object> request) {
		this.requestMap = request;
	}
}
